package com.x.compute.common.handle;

import com.x.compute.common.constant.VarTypeEnum;
import com.x.compute.common.entity.VarHandleResult;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * 文本变量处理
 * @author xuxin
 */
@Slf4j
public class StringVarHandle implements VarTypeHandle {

    @Override
    public VarTypeEnum type() {
        return VarTypeEnum.STRING;
    }

    @Override
    public String formatExpression(String expression) {
        return expression;
    }

    @Override
    public VarHandleResult handle(Map<String, Object> fieldMap, String expression) {
        return VarHandleResult.builder().expression(expression).build();
    }
}
